<template>
  <div>
    <div class="container1">
      <div class="common-title-flex">
        <div class="common-title-div"></div>
        <div class="common-title-text">违纪人员查询</div>
      </div>
      <el-form ref="searchObj" :inline="true" :model="searchObj" size="mini" label-width="80px" style="margin-bottom: -10px; margin-top: 10px">
        <el-form-item label="姓名">
          <el-input v-model="searchObj.name" placeholder="请输入姓名" clearable></el-input>
        </el-form-item>
        <el-form-item label="劳务公司">
          <el-input v-model="searchObj.company" placeholder="请输入劳务公司" clearable></el-input>
        </el-form-item>
        <el-form-item label="电话">
          <el-input v-model="searchObj.phone" placeholder="请输入电话" clearable></el-input>
        </el-form-item>
        <!-- <el-form-item label="备案登记">
                        <el-select v-model="searchObj.fxhc" placeholder="请选择备案登记" style="width:100%;">
                            <el-option
                            v-for="item in fxhcList"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="面试状态">
                        <el-select v-model="searchObj.jobStatus" placeholder="请选择面试状态" style="width:100%;">
                            <el-option
                            v-for="item in jobStatusList"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item> -->
        <el-form-item style="margin-left: 2rem">
          <el-button type="primary" icon="el-icon-search" @click="initDataList">查询</el-button>
          <el-button @click="reset" icon="el-icon-refresh">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="container" style="margin-top: 1rem">
      <div class="common-list-class">
        <div style="display: flex">
          <div class="common-title-div"></div>
          <div class="common-title-text">违纪人员列表</div>
        </div>
        <div style="display: flex">
          <!-- <el-button type="primary" size="mini" icon="el-icon-set-up" @click="allPassClick">批量面试</el-button>
                    <el-button type="primary" size="mini"  @click="riskCheck" icon="el-icon-position">备案登记</el-button> -->
          <el-button type="primary" size="mini" @click="adddisobey" icon="el-icon-circle-plus-outline">新建违纪人员</el-button>
          <el-button type="primary" size="mini" icon="el-icon-download" @click="uploadinfoCard">批量导出</el-button>
        </div>
      </div>
      <!-- 查询列表 -->
      <el-table :data="tableData" size="mini" :row-style="rowStyle" :header-cell-style="tableHeaderColor" style="width: 100%; margin-top: 10px; margin-bottom: 10px" @selection-change="handleSelectionChange" max-height="550" border>
        <!-- <el-table-column type="selection" width="55" align="center">
        </el-table-column> -->
        <el-table-column prop="illegalName" label="姓名" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="illegalIdentity" label="身份证" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="illegalPhone" label="电话" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="illegalTypeDesc" label="违纪类型" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="illegalTime" label="违纪时间" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="labourName" label="劳务公司" show-overflow-tooltip align="center">
        </el-table-column>
        <!-- <el-table-column
          prop="createTime"
          label="简历填写时间"
          width="200"
          show-overflow-tooltip
          align="center"
        >
        </el-table-column> -->
        <!-- <el-table-column
          prop="surveyStatus"
          label="备案登记"
          show-overflow-tooltip
          align="center"
        >
          <template slot-scope="scope">
            {{ surveyStatusObj[scope.row.surveyStatus] }}
          </template>
        </el-table-column> -->
        <!-- <el-table-column
          prop="violationDiscipline"
          label="是否违纪"
          show-overflow-tooltip
          align="center"
        >
          <template slot-scope="scope">
            {{ violationDisciplineObj[scope.row.violationDiscipline] }}
          </template>
        </el-table-column> -->
        <el-table-column fixed="right" label="操作" width="350" align="center">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" icon="el-icon-tickets" @click="detailsClick(scope.row)">详情</el-button>
            <el-button v-if="scope.row.verifyStatus == '1' && roleCode == 'businessManage'" type="danger" size="mini" icon="el-icon-warning" @click="openintegralClick(scope.row)">违纪处理</el-button>
            <el-button type="success" size="mini" @click="handleClick(scope.row)" icon="el-icon-share">处理流程</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-row type="flex" justify="end">
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="pageSizes" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
      </el-row>
    </div>
    <!-- 警员详情 -->
    <el-dialog title="违纪人员详情" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="detailsFlag" width="50%" :before-close="detailsClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">违纪人员详情</div>
      </div>
      <div style="overflow: auto">
        <div>
          <el-row type="flex" justify="center" style="margin-top: 1rem">
            <el-col :span="5" class="bold-class">姓名</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.illegalName
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">手机号</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.illegalPhone
            }}</el-col>
          </el-row>

          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">身份证</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.illegalIdentity
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center" style="margin-top: 1rem">
            <el-col :span="5" class="bold-class">违纪时间</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.illegalTime
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">所在劳务公司</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.labourName
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">服务企业</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.componentName
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center" style="margin-top: 1rem">
            <el-col :span="5" class="bold-class">违纪类型</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.illegalTypeDesc
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">违纪内容</el-col>
            <el-col :span="15" class="grey-class" show-overflow-tooltip>{{
              employeeInfo.illegalDesc
            }}</el-col>
          </el-row>
          <el-row type="flex" justify="center">
            <el-col :span="5" class="bold-class">审核情况</el-col>
            <el-col :span="15" class="grey-class">{{
              employeeInfo.verifyStatusDesc
            }}</el-col>
          </el-row>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="detailsClose">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 批量入职 -->
    <el-dialog title="是否面试通过" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="passFlag" width="40%" :before-close="passClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">是否面试通过</div>
      </div>
      <el-row type="flex" justify="center">
        <el-col :span="18">共有<span style="color: red; font-size: 16px; font-weight: bold">{{
            selectList.length
          }}</span>人进行操作！</el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="mini" @click="passClickMethod">通 过</el-button>
        <el-button type="primary" size="mini" @click="ispassClickMethod">待 定</el-button>
        <el-button type="danger" size="mini" @click="nopassClickMethod">未通过</el-button>
      </span>
    </el-dialog>
    <!-- 备案登记 -->
    <el-dialog title="备案登记" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="fxhcFlag" width="40%" :before-close="fxhcClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">备案登记</div>
      </div>
      <el-row type="flex" justify="center">
        <el-col :span="18">共有<span style="color: red; font-size: 16px; font-weight: bold">{{
            selectList.length
          }}</span>人需要备案登记：</el-col>
      </el-row>
      <!-- <el-row type="flex" justify="center" v-for="(item,index) in fxhcDetails" :key="index">
                <el-col :span="14" class="bold-class">{{item.name}}</el-col>
                <el-col :span="4" class="grey-class">{{item.number}}人</el-col>
            </el-row> -->
      <el-row type="flex" justify="center">
        <el-col :span="18" style="color: #b7b7b7; font-size: 12px"><i class="el-icon-s-opportunity" style="color: #f6ae56"></i>温馨提示：您的申请将会有专员进行处理，请申请等待</el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="mini" @click="applicationClick">申请备案</el-button>
        <el-button size="mini" @click="fxhcClose">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 新建违规人员 -->
    <el-dialog title="新建违纪人员" :visible.sync="newFlag" center width="50%">
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">新建违纪人员</div>
      </div>
      <el-form :model="inputObj" label-width="80px" ref="inputObj">
        <el-form-item label="姓名" class="required-content-red">
          <el-input v-model="inputObj.illegalName" size="mini" placeholder="请输入姓名"></el-input>
        </el-form-item>
        <el-form-item label="手机号" class="required-content-red">
          <el-input v-model="inputObj.illegalPhone" size="mini" placeholder="请输入手机号"></el-input>
        </el-form-item>
        <el-form-item label="身份证号" class="required-content-red">
          <el-input v-model="inputObj.illegalIdentity" size="mini" placeholder="请输入身份证号"></el-input>
        </el-form-item>
        <el-form-item label="违纪时间" style="width: 100%" class="required-content-red">
          <el-date-picker style="width: 100%;" size="mini" v-model="inputObj.illegalTime" unlink-panels type="date" start-placeholder="开始日期" placeholder="请选择时间" value-format="yyyy-MM-dd HH:mm:ss">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="违纪类型" class="required-content-red">
          <el-select v-model="inputObj.illegalDesc" placeholder="请选择类型" size="mini" style="width: 100%">
            <el-option v-for="item in topicTypequeryList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="违纪内容" class="required-content-red">
          <el-input v-model="inputObj.content" size="mini" autocomplete="off" placeholder="请输入违纪内容" :row="2" type="textarea"></el-input>
        </el-form-item>
        <!-- <el-form-item label="处理反馈">
          <el-input
            v-model="inputObj.feedback"
            size="mini"
            autocomplete="off"
            placeholder="请输入反馈内容"
            :row="2"
            type="textarea"
          ></el-input>
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="addconfirm">确 定</el-button>
      </div>
    </el-dialog>
    <!-- 流程图展示 -->
    <el-dialog title="流程图展示" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="handFlag" width="40%" :before-close="progressClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">流程图展示</div>
      </div>
      <div>
        <el-timeline>
          <el-timeline-item v-for="(item, index) in progressList" :key="index" icon="el-icon-success" type="primary" size="large" :timestamp="item.createTime" placement="top">
            <el-card class="el_card_class">
              <h4>{{ item.processContent }}</h4>
              <div style="font-size: 12px">{{ item.processUser }}</div>
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="progressClose">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 违纪处理 -->
    <el-dialog title="反馈" :visible.sync="newfeedback" center width="50%">
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">反馈</div>
      </div>
      <el-form :model="feedbackObj" label-width="80px" ref="feedbackObj">
        <el-form-item label="反馈信息" class="required-content-red">
          <el-input v-model="feedbackObj.processContent" type="textarea" size="mini" placeholder="请输入反馈信息"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" @click="Approved">审核通过</el-button>
        <el-button size="mini" @click="Auditfailed">审核驳回</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixin/mixin.js";
export default {
  name: "offendpeople",
  mixins: [mixin],
  data() {
    return {
      imageUrl:
        "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      passFlag: false,
      jobStatusList: [
        {
          value: "0",
          label: "待面试",
        },
        {
          value: "1",
          label: "待定",
        },
      ],
      judgeList: [],
      workList: [],
      educateList: [],
      familyList: [],
      laboerRadio: "基本信息",
      tabList: [
        {
          title: "基本信息",
        },
        {
          title: "家庭信息",
        },
        {
          title: "学历信息",
        },
        {
          title: "工作经历",
        },
        {
          title: "紧急联系人",
        },
      ],
      violationDisciplineObj: {
        0: "未违纪",
        1: "已违纪",
      },
      jobStatusObj: {
        0: "待面试",
        1: "待确认",
        2: "面试通过",
        3: "待入职",
        6: "面试不通过",
      },
      surveyStatusObj: {
        0: "未提交",
        1: "已提交",
        2: "备案中",
        3: "已备案",
      },
      fxhcFlag: false,
      fxhcList: [
        {
          value: "",
          label: "全部",
        },
        {
          value: "0",
          label: "未提交",
        },
        {
          value: "1",
          label: "已提交",
        },
        {
          value: "2",
          label: "备案中",
        },
        {
          value: "3",
          label: "已备案",
        },
      ],
      topicTypequeryList: [
        {
          value: 1,
          label: "打架斗殴",
        },
        {
          value: 2,
          label: "精神异常",
        },
        {
          value: 3,
          label: "企业内盗",
        },
      ],
      fxhcCount: 134,
      fxhcDetails: [],
      employeeInfo: {},
      handInfo: {},
      employeeDetails: {},
      detailsFlag: false,
      isEditTitle: "",
      newaddFlag: false,
      pageSizes: [10, 15, 50, 100],
      pagesize: 10,
      total: 10,
      currentPage: 1,
      selectList: [],
      newFlag: false,
      handFlag: false,
      newfeedback: false,
      tableData: [
        {
          enterPrise: "",
          deliverTime: "",
          postNumber: "",
          audit: "",
          isfindTitle: "",
        },
      ],
      searchObj: {
        name: "",
        company: "",
        phone: "",
        fxhc: "",
        jobStatus: "0",
        adddisobey: false,
      },
      inputObj: {
        illegalName: "",
        illegalPhone: "",
        illegalIdentity: "",
        illegalTime: "",
        illegalDesc: "",
        content: "",
        illegalType: "",
      },
      feedbackObj: {
        processContent: "",
      },
      progressList: [],
      currentId: "",
      currentCode: "",
    };
  },
  created() {
    this.initDataList();
  },

  methods: {
    //审核通过
    Approved() {
      this.integralClick(2);
    },
    //审核失败
    Auditfailed() {
      this.integralClick(3);
    },

    openintegralClick(row) {
      console.log(row);
      this.newfeedback = true;
      this.currentId = row.id;
      this.currentCode = row.processCode;
    },
    //关闭流程展示图
    progressClose() {
      this.handFlag = false;
    },
    //取消
    cancel() {
      this.newFlag = false;
      this.inputObj = {};
    },
    //确定添加
    addconfirm() {
      if (!this.inputObj.illegalName || !this.inputObj.illegalName.length) {
        this.$message({
          message: "请输入姓名",
          type: "error",
        });
        return;
      }
      if (!this.inputObj.illegalPhone || !this.inputObj.illegalPhone.length) {
        this.$message({
          message: "请输入手机号",
          type: "error",
        });
        return;
      }
      if (
        !this.inputObj.illegalIdentity ||
        !this.inputObj.illegalIdentity.length
      ) {
        this.$message({
          message: "请输入身份证",
          type: "error",
        });
        return;
      }
      if (!this.inputObj.illegalTime || !this.inputObj.illegalTime.length) {
        this.$message({
          message: "请选择时间",
          type: "error",
        });
        return;
      }
      if (!this.inputObj.content || !this.inputObj.content.length) {
        this.$message({
          message: "请输入违纪内容",
          type: "error",
        });
        return;
      }
      this.initallTagList();
    },
    //新增违纪人员
    adddisobey() {
      this.newFlag = true;
    },

    laboerRadioChange(value) {
      this.laboerRadio = value;
    },
    //违纪处理
    integralClick(flag) {
      if (
        !this.feedbackObj.processContent ||
        !this.feedbackObj.processContent.length
      ) {
        this.$message.error("请输入违纪内容！");
        return;
      }
      let params = {
        id: this.currentId,
        processCode: this.currentCode,
        processContent: this.feedbackObj.processContent,
        verifyStatus: flag,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/addIllegalPeopleLogInfo`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
        params: params,
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.newfeedback = false;
            this.feedbackObj = {};
            this.initDataList();
            this.$message({
              message: res.data.message,
              type: "success",
            });
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },

    //处理流程
    handleClick(row) {
      console.log(row.processCode);
      this.showLoading();
      this.$axios({
        method: "get",
        url: `/labour/queryIllegalPeopleLogByCode/${row.processCode}`,
        headers: {
          Authorization: this.requestToken,
        },
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.handFlag = true;
            // this.handInfo = res.data.data || {};
            this.progressList = res.data.data;
            console.log(this.progressList);
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },

    initDataList() {
      let params = {
        illegalName: this.searchObj.name,
        componentName: this.searchObj.company,
        illegalPhone: this.searchObj.phone,
        flag: 2,
        jobStatus: "0",
        pageNumber: this.currentPage,
        pageSize: this.pagesize,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/queryIllegalPeopleListByPage`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
        params: params,
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.tableData = res.data.data.list;
            this.pagesize = res.data.data.pageSize;
            this.total = res.data.data.total;
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },
    //新增
    initallTagList() {
      let params = {
        illegalName: this.inputObj.illegalName,
        illegalPhone: this.inputObj.illegalPhone,
        illegalIdentity: this.inputObj.illegalIdentity,
        illegalTime: this.inputObj.illegalTime
          .replace(/-/g, "")
          .replace(/\s/g, "")
          .replace(/\:/g, ""),
        illegalType: this.inputObj.illegalDesc,
        illegalDesc: this.inputObj.content,
        // illegalType: this.inputObj.illegalType,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/addIllegalPeopleInfo`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
        params: params,
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.newFlag = false;
            this.inputObj = {};
            this.initDataList();
            // this.initDataList();
            this.$message({
              message: res.data.message,
              type: "success",
            });
            // let dataList = res.data.data;
            // let list = [];
            // dataList.forEach((item) => {
            //   list.push({
            //     value: item.id,
            //     label: item.content,
            //   });
            // });
            // this.allList = list;
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },

    allExportClick() {
      return;
      let self = this;
      let params = {
        flag: "1",
      };
      self.showLoading("操作中");
      self
        .$axios({
          method: "post",
          url: `/labour/exportedNormalIllegaPeople`,
          responseType: "blob",
          params: params,
          data: list,
        })
        .then((res) => {
          console.log(res);
          self.hideLoading();
          if (res.status == "200") {
            let href = window.URL.createObjectURL(new Blob([res.data]));
            let link = document.createElement("a");
            link.style.display = "none";
            link.href = href;
            link.setAttribute("download", "违纪人员导出.xlsx");
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            window.URL.revokeObjectURL(href);
          } else {
            self.$message.error(res.data.message);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
    allpasscheckMethod(status) {
      let params = {
        idList: this.selectList.map((value) => value["id"]),
        jobStatus: status,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/editEmployeeForInterview`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
      })
        .then((res) => {
          this.hideLoading();
          if (res.data.code == "20000") {
            this.$message({
              message: res.data.message,
              type: "success",
            });
            this.passFlag = false;
            this.initDataList();
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },
    // 通过
    passClickMethod() {
      this.allpasscheckMethod(2);
    },
    // 待定
    ispassClickMethod() {
      this.allpasscheckMethod(1);
    },
    // 不通过
    nopassClickMethod() {
      this.allpasscheckMethod(6);
    },
    passClose() {
      this.passFlag = false;
    },
    uploadinfoCard() {
      let self = this;
      // if (!this.selectList || !this.selectList.length) {
      //   this.$message({
      //     message: "请选择数据！",
      //     type: "error",
      //   });
      //   return;
      // }
      // 批量导出
      let params = {
        illegalName: this.searchObj.name,
        componentName: this.searchObj.company,
        illegalPhone: this.searchObj.phone,
        flag: 2,
        jobStatus: "0",
      };
      self.showLoading("操作中");
      self
        .$axios({
          method: "post",
          headers: {
            Authorization: self.requestToken,
          },
          url: `/labour/exportedNormalIllegaPeople`,
          responseType: "blob",
          data: params,
        })
        .then((res) => {
          self.hideLoading();
          console.log(res);
          if (res.status == 200) {
            let href = window.URL.createObjectURL(
              new Blob([res.data], {
                type:
                  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
              })
            );
            let link = document.createElement("a");
            link.style.display = "none";
            link.href = href;
            link.setAttribute("download", `违纪信息.xlsx`);
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            window.URL.revokeObjectURL(href);
          } else {
            self.$message.error(`违纪信息导出失败！`);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
    allPassClick() {
      if (!this.selectList || !this.selectList.length) {
        this.$message({
          message: "请选择批量面试通过数据！",
          type: "error",
        });
        return;
      }
      this.passFlag = true;
    },
    riskCheck() {
      if (!this.selectList || !this.selectList.length) {
        this.$message({
          message: "请选择需要备案数据！",
          type: "error",
        });
        return;
      }
      this.fxhcFlag = true;
    },
    applicationClick() {
      let list = [];
      this.selectList.forEach((item) => {
        list.push({
          id: item.id,
          openId: item.openId,
          componentCode: item.componentCode,
          surveyStatus: "1",
        });
      });
      let params = {
        ids: list,
        flag: 1,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/checkLabor`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.fxhcFlag = false;
            this.$message({
              message: res.data.message,
              type: "success",
            });
            this.initDataList();
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },
    fxhcClose() {
      this.fxhcFlag = false;
    },
    tableHeaderColor({ row, column, rowIndex, columnIndex }) {
      return "background-color:#f5f5f5;color:#626262;";
    },
    rowStyle({ row, rowIndex }) {
      let style1 = {};
      let style2 = {};
      if (rowIndex % 2 == 0) {
        style1.background = "#ffffff";
        return style1;
      } else {
        style2.background = "#f5f5f5";
        return style2;
      }
    },
    handleSelectionChange(value) {
      this.selectList = value;
      console.log(this.selectList);
      if (value && value.length) {
        let dataList = value.map((item) => item["labourName"]);
        let list = this.getRepeatNum(dataList);
        let fxhcDetails = [];
        for (let i in list) {
          fxhcDetails.push({
            name: i,
            number: list[i],
          });
        }
        this.fxhcDetails = fxhcDetails;
      }
    },
    getRepeatNum(arr) {
      return arr.reduce(function (prev, next) {
        prev[next] = prev[next] + 1 || 1;
        return prev;
      }, []);
    },
    beforeUpload(file) {
      this.showLoading("导入中");
    },
    uploadSucess(response) {
      this.$message({
        message: "导入成功！",
        type: "success",
      });
      this.hideLoading();
      console.log("response------", response);
    },
    uploadError(error) {
      this.$message({
        message: "导入失败！",
        type: "error",
      });
      this.hideLoading();
      console.log("error-----", error);
    },
    //新建取消
    dialogFormVisible() {
      this.newFlag = false;
      this.inputObj = {};
    },

    // 取消点击
    handleClose() {
      this.cancel();
    },
    // 点击分页当前页多少数据
    handleSizeChange(val) {
      this.pagesize = val;
      this.initDataList();
    },
    // 点击分页页数
    handleCurrentChange(val) {
      this.currentPage = val;
      this.initDataList();
    },
    //  重置
    reset() {
      this.searchObj = {
        name: "",
        company: "",
        phone: "",
        fxhc: "",
        jobStatus: "0",
      };
      this.initDataList();
    },
    // 注销
    logoutClick() {
      this.$confirm("请确认是否注销该劳务工?", "注销", {
        confirmButtonText: "是",
        cancelButtonText: "否",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "注销成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消注销",
          });
        });
    },
    // 详情
    detailsClick(row) {
      console.log(row);
      this.showLoading();
      this.$axios({
        method: "get",
        url: `/labour/queryIllegalPeopleById/${row.id}`,
        headers: {
          Authorization: this.requestToken,
        },
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.detailsFlag = true;
            this.employeeInfo = res.data.data || {};
            // this.employeeDetails = res.data.data || {};
            // this.familyList = res.data.data || [];
            // this.educateList = res.data.data || [];
            // this.workList = res.data.data || [];
            // this.judgeList = res.data.data || [];
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },
    // 详情关闭
    detailsClose() {
      this.laboerRadio = "基本信息";
      this.detailsFlag = false;
    },
  },
};
</script>
<style scoped>
/* .el-switch__core:after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    border-radius: 100%;
    transition: all .3s;
    width: 16px;
    height: 16px;
    background-color: #fff;
  }
  .el-switch.is-checked .el-switch__core:after {
    left: 100%;
    margin-left: -17px;
  } */
.common-title-flex {
  display: flex;
}
.common-title-div {
  width: 3px;
  height: 16px;
  background-color: #368af7;
  margin-top: 2px;
}
.common-title-text {
  margin-left: 4px;
  font-size: 14px;
}
.common-list-class {
  display: flex;
  justify-content: space-between;
  margin-top: -10px;
}
.upload-file >>> .el-upload--text {
  border: none;
  width: 100px;
  height: 36px;
}
</style>>